package base.thread_JUC2.chapter04.demo09;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

public class ExecutableTask implements Callable<String> {
    private String name;

    public ExecutableTask(String name){
        this.name = name;
    }
    public String getName(){
        return name;
    }

    @Override
    public String call() throws Exception {
        long duration = (long) (Math.random() * 10);
        TimeUnit.SECONDS.sleep(duration);
        return "任务执行结果：^_^ "+name+" ^_^";
    }
}
